package Study.company;

import java.util.Scanner;

public class Practice03 {
    public static void main(String[] args) {
        // 给定一个整数数组，输入一个值 n, 输出数组中第 n 大的数。
        int[] num ={2, 3, 1, 8, 3, 9, 6};
        for (int i = 0; i < num.length ; i++) {
            int crue = i;
            for (int j = i; j < num.length ; j++) {
                if(num[crue] > num[j]){
                    crue = j;
                }
            }
            int temp = num[i];
            num[i] = num[crue];
            num[crue] = temp;
        }
        for (int i:num
             ) {
            System.out.print(i + "\t");
        }
        System.out.println();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个值 n：");
        int number = sc.nextInt();
        System.out.println(num[number - 1]);
    }
}
